
#ifndef _NEBULA_SDK__SERVICEFACTORY_H_
#define _NEBULA_SDK__SERVICEFACTORY_H_

namespace nebula { namespace sdk {

class IService;

class IServiceFactory
{
public:
	virtual ~IServiceFactory() {};
	virtual IService* CreateService() = 0;
	virtual IServiceFactory* Clone()  = 0;
};

template<typename _TYPE>
struct ServiceAutoFactory : IServiceFactory
{
	typedef ServiceAutoFactory<_TYPE> this_type;

	IService* CreateService()
	{
		return new _TYPE();
	}

	ServiceAutoFactory* Clone()
	{
		return new this_type();
	}
};

}}

#endif // _NEBULA_SDK__SERVICEFACTORY_H_

